import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
  //  {
  //   title: '所属公司',
  //   align:"center",
  //   sorter: true,
  //   dataIndex: 'supplier_dictText'
  //  },
   {
    title: '姓名',
    align:"center",
    sorter: true,
    dataIndex: 'realName'
   },
  //  {
  //   title: '服务次数',
  //   align:"center",
  //   sorter: true,
  //   dataIndex: 'serviceCount'
  //  },
   {
    title: '性别',
    align:"center",
    sorter: true,
    dataIndex: 'jender_dictText'
   },
   {
    title: '学历',
    align:"center",
    sorter: true,
    dataIndex: 'education_dictText'
   },
   {
    title: '专业',
    align:"center",
    sorter: true,
    dataIndex: 'major'
   },
   {
    title: '工作年限',
    align:"center",
    sorter: true,
    dataIndex: 'workYears'
   },
   {
    title: '技能项',
    align:"center",
    dataIndex: 'skill_dictText'
   },
  //  {
  //   title: '人员需求',
  //   align:"center",
  //   sorter: true,
  //   dataIndex: 'positionReqId_dictText'
  //  },
   // {
   //  title: '简历状态',
   //  align:"center",
   //  sorter: true,
   //  dataIndex: 'resumeStatus_dictText'
   // },
   {
    title: '面试阶段',
    align:"center",
    sorter: true,
    dataIndex: 'assignStatus_dictText',
    customRender: ({ text }) => {
      if(text =='一面分配') {
        return render.renderTag(text, 'blue');
      } else if(text =='二面分配') {
        return render.renderTag(text, 'green');
      } else 
      {
        return render.renderTag(text, 'grey');
      }
    }
   },
   {
    title: '面试结果',
    align:"center",
    sorter: true,
    dataIndex: 'interviewResult_dictText',
    customRender: ({ text }) => {
      if(text =='锁定中') {
        return render.renderTag(text, 'blue');
      } else {
        return text;
      }
    }
   },
  //  {
  //   title: '锁定状态',
  //   align:"center",
  //   sorter: true,
  //   dataIndex: 'lockStatus_dictText',
  //   customRender: ({ text }) => {
  //     if(text =='锁定中') {
  //       return render.renderTag(text, 'blue');
  //     } else {
  //       return text;
  //     }
  //   }
  //  },
  //  {
  //   title: '锁定项目数',
  //   align:"center",
  //   sorter: true,
  //   dataIndex: 'lockProjectCount'
  //  },
   {
    title: '面试人员',
    align:"center",
    sorter: true,
    dataIndex: 'lockBy_dictText'
   },
  //  {
  //   title: '简历附件',
  //   align:"center",
  //   dataIndex: 'resumeFile',
  //  },
  //  {
  //   title: '创建人',
  //   align:"center",
  //   sorter: true,
  //   dataIndex: 'createBy'
  //  },
  //  {
  //   title: '创建日期',
  //   align:"center",
  //   sorter: true,
  //   dataIndex: 'createTime'
  //  },
  //  {
  //   title: '更新人',
  //   align:"center",
  //   sorter: true,
  //   dataIndex: 'updateBy'
  //  },
  //  {
  //   title: '更新日期',
  //   align:"center",
  //   sorter: true,
  //   dataIndex: 'updateTime'
  //  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "所属公司",
      field: "supplier",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"tm_supplier_manage,supplier_name,id"
      },
      //colProps: {span: 6},
 	},
	{
      label: "姓名",
      field: "realName",
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "性别",
      field: "jender",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"sex"
      },
      //colProps: {span: 6},
 	},
	{
      label: "邮箱",
      field: "email",
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "出生日期",
      field: "birthday",
      component: 'DatePicker',
      //colProps: {span: 6},
 	},
	{
      label: "学历",
      field: "education",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"education"
      },
      //colProps: {span: 6},
 	},
	{
      label: "专业",
      field: "major",
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "技能项",
      field: "skill",
      component: 'JSelectMultiple',
      componentProps:{
           dictCode:"skill_list",
           triggerChange: true
      },
      //colProps: {span: 6},
 	},
	{
      label: "筛选状态",
      field: "filterStatus",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"filter_status"
      },
      //colProps: {span: 6},
 	},
	{
      label: "简历状态",
      field: "resumeStatus",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"resume_status"
      },
      //colProps: {span: 6},
 	},
	{
      label: "入场状态",
      field: "entryStatus",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"entry_status"
      },
      //colProps: {span: 6},
 	},
	{
      label: "锁定状态",
      field: "lockStatus_dictText",
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "锁定人",
      field: "lockBy",
      component: 'Input',
      //colProps: {span: 6},
 	},
	// {
  //     label: "创建人",
  //     field: "createBy",
  //     component: 'Input',
  //     //colProps: {span: 6},
 	// },
	// {
  //     label: "创建日期",
  //     field: "createTime",
  //     component: 'DatePicker',
  //     componentProps: {
  //        showTime:true,
  //        valueFormat: 'YYYY-MM-DD HH:mm:ss'
  //      },
  //     //colProps: {span: 6},
 	// },
	// {
  //     label: "更新人",
  //     field: "updateBy",
  //     component: 'Input',
  //     //colProps: {span: 6},
 	// },
	// {
  //     label: "更新日期",
  //     field: "updateTime",
  //     component: 'DatePicker',
  //     componentProps: {
  //        showTime:true,
  //        valueFormat: 'YYYY-MM-DD HH:mm:ss'
  //      },
  //     //colProps: {span: 6},
 	// },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '所属公司',
    field: 'supplier',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"tm_supplier_manage,supplier_name,id"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入所属公司!'},
          ];
     },
  },
  {
    label: '姓名',
    field: 'realName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入姓名!'},
          ];
     },
  },
  {
    label: '身份证号',
    field: 'idNo',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入身份证号!'},
                 { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
          ];
     },
  },
  {
    label: '性别',
    field: 'jender',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"sex"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入性别!'},
          ];
     },
  },
  {
    label: '电话',
    field: 'mobile',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入电话!'},
                 { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
          ];
     },
  },
  {
    label: '邮箱',
    field: 'email',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入邮箱!'},
                 { pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件!'},
          ];
     },
  },
  {
    label: '出生日期',
    field: 'birthday',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入出生日期!'},
          ];
     },
  },
  {
    label: '学历',
    field: 'education',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"education"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入学历!'},
          ];
     },
  },
  {
    label: '专业',
    field: 'major',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入专业!'},
          ];
     },
  },
  {
    label: '工作年限',
    field: 'workYears',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入工作年限!'},
                 { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
          ];
     },
  },
  {
    label: '技能项',
    field: 'skill',
    component: 'JSelectMultiple',
    componentProps:{
        dictCode:"skill_list"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入技能项!'},
          ];
     },
  },
  {
    label: '简历附件',
    field: 'resumeFile',
    component: 'JUpload',
    componentProps:{
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入简历附件!'},
          ];
     },
  },
  {
    label: '简历内容',
    field: 'resumeContentString',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入简历内容!'},
          ];
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
//子表表格配置
export const resumeEvaluateRecordColumns: JVxeColumn[] = [
    {
      title: '项目',
      key: 'projectId',
      type: JVxeTypes.selectSearch,
      dictCode:"tm_project,project_name,id",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '面试官',
      key: 'interviewer',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '面试结果',
      key: 'resumeInterviewResult',
      type: JVxeTypes.select,
      options:[],
      dictCode:"resume_interview_result",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '面试评价',
      key: 'resumeEvaluate',
      type: JVxeTypes.textarea,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
  ]
export const projectEntryDetailColumns: JVxeColumn[] = [
    {
      title: '项目',
      key: 'projectId',
      type: JVxeTypes.selectSearch,
      dictCode:"tm_project,project_name,id",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '项目经理',
      key: 'pmId',
      type: JVxeTypes.userSelect,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '职场地点',
      key: 'workPlace',
      type: JVxeTypes.selectSearch,
      dictCode:"tm_work_place,work_place,id",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '订单编号',
      key: 'orderNo',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '合同开始时间',
      key: 'contractStartTime',
      type: JVxeTypes.date,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '合同结束时间',
      key: 'contractEndTime',
      type: JVxeTypes.date,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '入项时间',
      key: 'entryTime',
      type: JVxeTypes.date,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '离项时间',
      key: 'departureTime',
      type: JVxeTypes.date,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '供应商',
      key: 'supplier',
      type: JVxeTypes.selectSearch,
      dictCode:"tm_supplier_manage,supplier_name,id",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '职级',
      key: 'positionLevel',
      type: JVxeTypes.select,
      options:[],
      dictCode:"position_level",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
  ]
export const departureEvaluateRecordColumns: JVxeColumn[] = [
    {
      title: '项目',
      key: 'projectId',
      type: JVxeTypes.selectSearch,
      dictCode:"tm_project,project_name,id",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '评价人',
      key: 'departureBy',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '离场状态',
      key: 'departureStatus',
      type: JVxeTypes.select,
      options:[],
      dictCode:"departure_status",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '离场时间',
      key: 'departureTime',
      type: JVxeTypes.date,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '离场评价',
      key: 'departureEvaluate',
      type: JVxeTypes.textarea,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]

// 高级查询数据
export const superQuerySchema = {
  supplier: {title: '所属公司',order: 0,view: 'list', type: 'string',dictTable: "tm_supplier_manage", dictCode: 'id', dictText: 'supplier_name',},
  realName: {title: '姓名',order: 1,view: 'text', type: 'string',},
  serviceCount: {title: '服务次数',order: 2,view: 'number', type: 'number',},
  jender: {title: '性别',order: 4,view: 'list', type: 'string',dictCode: 'sex',},
  education: {title: '学历',order: 8,view: 'list', type: 'string',dictCode: 'education',},
  major: {title: '专业',order: 9,view: 'text', type: 'string',},
  workYears: {title: '工作年限',order: 10,view: 'number', type: 'number',},
  skill: {title: '技能项',order: 11,view: 'list_multi', type: 'string',dictCode: 'skill_list',},
  filterStatus: {title: '筛选状态',order: 12,view: 'list', type: 'string',dictCode: 'filter_status',},
  resumeStatus: {title: '简历状态',order: 13,view: 'list', type: 'string',dictCode: 'resume_status',},
  entryStatus: {title: '入场状态',order: 14,view: 'list', type: 'string',dictCode: 'entry_status',},
  lockStatus: {title: '锁定状态',order: 15,view: 'text', type: 'string',},
  lockBy: {title: '锁定人',order: 16,view: 'text', type: 'string',},
  resumeFile: {title: '简历附件',order: 17,view: 'file', type: 'string',},
  createBy: {title: '创建人',order: 19,view: 'text', type: 'string',},
  createTime: {title: '创建日期',order: 20,view: 'datetime', type: 'string',},
  updateBy: {title: '更新人',order: 21,view: 'text', type: 'string',},
  updateTime: {title: '更新日期',order: 22,view: 'datetime', type: 'string',},
  //子表高级查询
  resumeEvaluateRecord: {
    title: '面试评价',
    view: 'table',
    fields: {
        projectId: {title: '项目',order: 0,view: 'sel_search', type: 'string',dictTable: "tm_project", dictCode: 'id', dictText: 'project_name',},
        interviewer: {title: '面试官',order: 2,view: 'text', type: 'string',},
        resumeInterviewResult: {title: '面试结果',order: 3,view: 'list', type: 'string',dictCode: 'resume_interview_result',},
        resumeEvaluate: {title: '面试评价',order: 4,view: 'textarea', type: 'string',},
        createBy: {title: '创建人',order: 5,view: 'text', type: 'string',},
        createTime: {title: '创建日期',order: 6,view: 'datetime', type: 'string',},
        updateBy: {title: '更新人',order: 7,view: 'text', type: 'string',},
        updateTime: {title: '更新日期',order: 8,view: 'datetime', type: 'string',},
    }
  },
  projectEntryDetail: {
    title: '入场信息',
    view: 'table',
    fields: {
        projectId: {title: '项目',order: 0,view: 'sel_search', type: 'string',dictTable: "tm_project", dictCode: 'id', dictText: 'project_name',},
        pmId: {title: '项目经理',order: 1,view: 'sel_user', type: 'string',},
        workPlace: {title: '职场地点',order: 2,view: 'sel_search', type: 'string',dictTable: "tm_work_place", dictCode: 'id', dictText: 'work_place',},
        contractEndTime: {title: '合同结束时间',order: 5,view: 'date', type: 'string',},
        supplier: {title: '供应商',order: 8,view: 'sel_search', type: 'string',dictTable: "tm_supplier_manage", dictCode: 'id', dictText: 'supplier_name',},
        positionLevel: {title: '职级',order: 9,view: 'list', type: 'string',dictCode: 'position_level',},
    }
  },
  departureEvaluateRecord: {
    title: '离场评价',
    view: 'table',
    fields: {
        projectId: {title: '项目',order: 0,view: 'sel_search', type: 'string',dictTable: "tm_project", dictCode: 'id', dictText: 'project_name',},
        departureBy: {title: '评价人',order: 1,view: 'text', type: 'string',},
        departureStatus: {title: '离场状态',order: 2,view: 'list', type: 'string',dictCode: 'departure_status',},
        departureTime: {title: '离场时间',order: 3,view: 'date', type: 'string',},
        departureEvaluate: {title: '离场评价',order: 4,view: 'textarea', type: 'string',},
    }
  },
};
